import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    key: localStorage.getItem("key") ? localStorage.getItem("key") : "",
    wechatState: null,
    show: false,
    count: 5,
    isIos: false,
    topBannerShow:true
  },
  mutations: {
    isIos(state, num) {
      state.isIos = num
    },
    count(state, num) {
      state.count = num
    },
    show(state, e) {
      state.show = e
    },
    wechat(state, n) {
      console.log(n, 'smss')
      sessionStorage.setItem('wechat', n);
      state.wechatState = n;
    },
    setTopBanner(state,bool){
      state.topBannerShow = bool
    }
  },
  actions: {
    setTopBanner(context,bool){
      context.commit('setTopBanner',bool)
    }
  }
})